home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 551-575 / disk_563 / kpri / src.lzh / gadgets.c < prev    next >
C/C++ Source or Header  |  1991-11-01  |  7KB  |  232 lines

  1.  
  2. /*
  3.  * .tpl.c
  4.  *
  5.  * MACHINE GENERATED
  6.  */
  7.  
  8. #include "defs.h"
  9.  
  10. Prototype __regargs struct Gadget *InitGads(struct Screen *);
  11. Prototype void      FreeGads(void);
  12.  
  13. Prototype UBYTE         *Buf_storage_str;
  14.  
  15. Prototype struct Gadget *Gad_storage_str;
  16. Prototype struct Gadget *Gad_storage_list;
  17. Prototype struct Gadget *Gad_pagesize;
  18. Prototype struct Gadget *Gad_linelength;
  19. Prototype struct Gadget *Gad_split;
  20. Prototype struct Gadget *Gad_title;
  21. Prototype struct Gadget *Gad_filereq;
  22. Prototype struct Gadget *Gad_print_it;
  23. Prototype struct Gadget *Gad_automatic;
  24. Prototype struct Gadget *Gad_quit;
  25.  
  26. Prototype struct NewGadget  NGAry[11];
  27. Prototype struct MinList    List_storage_list;
  28.  
  29. #define xpos1   12
  30. #define xpos2   (xpos1 +  33)
  31. #define xpos3   (xpos1 + 180)
  32. #define xpos4   (xpos1 + 302)
  33.  
  34. #define ypos1   29
  35. #define ypos2   (ypos1 +  16)
  36. #define ypos3   (ypos1 +  32)
  37. #define ypos4   (ypos1 +  48)
  38. #define ypos5   (ypos1 +  64)
  39.  
  40.  
  41. /***********************  NGAry[11] **********************************/
  42. const UBYTE linesstr[]  = "lines per page";
  43. const UBYTE charsstr[]  = "chars per line";
  44. const UBYTE splitstr[]  = "split pages";
  45. const UBYTE addstr[]    = "add titlelines";
  46. const UBYTE automstr[]  = "automatic";
  47. const UBYTE loadstr[]   = "load files";
  48. const UBYTE quitstr[]   = "Q U I T";
  49. const UBYTE storagstr[] = "storage:";
  50. const UBYTE printstr[]  = "print it";
  51. const UBYTE forgetstr[] = "forget it";
  52.  
  53. struct NewGadget NGAry[11] =
  54. {
  55.   {xpos1, ypos1,59,  12, linesstr,  NULPTR, GAD_pagesize,     0x0002, NULPTR},
  56.   {xpos1, ypos2,59,  12, charsstr,  NULPTR, GAD_linelength,   0x0002, NULPTR},
  57.   {xpos2, ypos3, 0,   0, splitstr,  NULPTR, GAD_split,        0x0002, NULPTR},
  58.   {xpos2, ypos4, 0,   0, addstr,    NULPTR, GAD_title,        0x0002, NULPTR},
  59.   {xpos2, ypos5, 0,   0, automstr,  NULPTR, GAD_automatic,    0x0002, NULPTR},
  60.   {xpos1, 114, 177,  17, loadstr,   NULPTR, GAD_filereq,      0x0010, NULPTR},
  61.   {xpos1, 134, 177,  17, quitstr,   NULPTR, GAD_quit,         0x0010, NULPTR},
  62.   {xpos3,  30, 241, 101, storagstr, NULPTR, GAD_storage_list, 0x0004, NULPTR},
  63.   {xpos3, 110, 241,  17, NULPTR,    NULPTR, GAD_storage_str,  0x0004, NULPTR},
  64.   {xpos3, 134, 119,  17, printstr,  NULPTR, GAD_print_it,     0x0000, NULPTR},
  65.   {xpos4, 134, 119,  17, forgetstr, NULPTR, GAD_forget_it,    0x0000, NULPTR}
  66. };
  67.  
  68. /***********************  Gad_pagesize ******************************/
  69. struct Gadget *Gad_pagesize;
  70.  
  71. const UBYTE  *StatAry_pagesize[] =
  72. {
  73.   " 66",
  74.   " 88",
  75.   (void *) 0
  76. };
  77.  
  78. UBYTE **Ary_pagesize   = StatAry_pagesize;
  79.  
  80. /***********************  Gad_linelength ****************************/
  81. struct Gadget *Gad_linelength;
  82.  
  83. const UBYTE *StatAry_linelength[] =
  84. {
  85.   " 80",
  86.   " 96",
  87.   "132",
  88.   (void *) 0
  89. };
  90.  
  91. UBYTE **Ary_linelength  = StatAry_linelength;
  92.  
  93. /*****  Gad_split Gad_title Gad_filereq Gad_quit ********************/
  94. struct Gadget *Gad_split;
  95. struct Gadget *Gad_title;
  96. struct Gadget *Gad_filereq;
  97. struct Gadget *Gad_quit;
  98.  
  99. /***********************  Gad_storage_list **************************/
  100. struct Gadget *Gad_storage_list;
  101.  
  102. struct MinList List_storage_list =
  103. {
  104.   (PE *) &List_storage_list.mlh_Tail,
  105.   NULPTR,
  106.   (PE *) &List_storage_list.mlh_Head
  107. };
  108.  
  109. long   SelNo_storage_list  = 0;
  110.  
  111. /***********************  Gad_storage_str  **************************/
  112. struct Gadget *Gad_storage_str;
  113. UBYTE  *Buf_storage_str;
  114. const UBYTE  *DefText_storage_str = "Welcome to the machine ...";
  115.  
  116. /*****  Gad_print_it Gad_automatic Gad_forget_it ********************/
  117. struct Gadget *Gad_print_it;
  118. struct Gadget *Gad_automatic;
  119. struct Gadget *Gad_forget_it;
  120.  
  121. struct Gadget *GList;
  122. struct VisualInfo *VisInfo;
  123.  
  124. /***********************  InitGads(scr)  **************************/
  125. __regargs struct Gadget *
  126. InitGads(struct Screen *scr)
  127. {
  128.   struct Gadget *gad;
  129.   short  i;
  130.  
  131.   GList = (void *) 0;
  132.   if ((VisInfo = GetVisualInfo(scr, TAG_END)) == NULL)
  133.     return (NULPTR);
  134.  
  135.   struct NewGadget *ng;
  136.  
  137.   for ( i = 0, ng = NGAry;
  138.         i < sizeof(NGAry) / sizeof(NGAry[0]);
  139.         ++i, ++ng)
  140.   {
  141.     ng->ng_VisualInfo = VisInfo;
  142.     ng->ng_TextAttr   = scr->Font;
  143.   }
  144.  
  145.   if ((gad = CreateContext(&GList)) == NULL)
  146.     return (NULPTR);
  147.  
  148.   Gad_pagesize      = gad = CreateGadget( CYCLE_KIND, gad, NG_pagesize,
  149.                                           GTCY_Labels, Ary_pagesize,
  150.                                           GTCY_Active, pagesize,
  151.                                           TAG_END);
  152.   if (gad == NULL)
  153.     return (NULL);
  154.  
  155.   Gad_linelength    = gad = CreateGadget( CYCLE_KIND, gad, NG_linelength,
  156.                                           GTCY_Labels, Ary_linelength,
  157.                                           GTCY_Active, linelength,
  158.                                           TAG_END);
  159.   if (gad == NULL)
  160.     return (NULL);
  161.  
  162.   Gad_split         = gad = CreateGadget( CHECKBOX_KIND, gad, NG_split,
  163.                                           GTCB_Checked, split,
  164.                                           TAG_END);
  165.   if (gad == NULL)
  166.     return (NULL);
  167.  
  168.   Gad_title         = gad = CreateGadget( CHECKBOX_KIND, gad, NG_title,
  169.                                           GTCB_Checked, title,
  170.                                           TAG_END);
  171.   if (gad == NULL)
  172.     return (NULL);
  173.  
  174.   Gad_automatic     = gad = CreateGadget( CHECKBOX_KIND, gad, NG_automatic,
  175.                                           GTCB_Checked, autom,
  176.                                           TAG_END);
  177.   if (gad == NULL)
  178.     return (NULL);
  179.  
  180.   Gad_filereq       = gad = CreateGadget( BUTTON_KIND, gad, NG_filereq,
  181.                                           TAG_END);
  182.   if (gad == NULL)
  183.     return (NULL);
  184.  
  185.   Gad_quit          = gad = CreateGadget( BUTTON_KIND, gad, NG_quit,
  186.                                           TAG_END);
  187.   if (gad == NULL)
  188.     return (NULL);
  189.  
  190.   Gad_storage_str   = gad = CreateGadget( STRING_KIND, gad, NG_storage_str,
  191.                                           GTST_MaxChars, MAXPATH,
  192.                                           GTST_String,   DefText_storage_str,
  193.                                           TAG_END );
  194.   if (gad == NULL)
  195.     return (NULL);
  196.  
  197.   Buf_storage_str   = ((struct StringInfo *)Gad_storage_str->SpecialInfo)->Buffer;
  198.  
  199.   Gad_storage_list  = gad = CreateGadget( LISTVIEW_KIND, gad, NG_storage_list,
  200.                                           GTLV_Labels,        &List_storage_list,
  201.                                           GTLV_Selected,      SelNo_storage_list,
  202.                                           GTLV_ShowSelected,  Gad_storage_str,
  203.                                           TAG_END);
  204.   if (gad == NULL)
  205.     return (NULL);
  206.  
  207.   Gad_print_it      = gad = CreateGadget( BUTTON_KIND, gad, NG_print_it,
  208.                                           TAG_END);
  209.   if (gad == NULL)
  210.     return (NULL);
  211.  
  212.  
  213.   Gad_forget_it     = gad = CreateGadget( BUTTON_KIND, gad, NG_forget_it,
  214.                                           TAG_END);
  215.   if (gad == NULL)
  216.     return (NULL);
  217.  
  218.   return (GList);
  219. }
  220.  
  221. /***********************  FreeGads(void)  ****************************/
  222. void
  223. FreeGads(void)
  224. {
  225.   FreeGadgets(GList);
  226.   if (VisInfo)
  227.     FreeVisualInfo(VisInfo);
  228.   VisInfo = NULL;
  229.   GList   = NULL;
  230. }
  231.  
  232.